<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      * {
        margin: 0px;
        padding: 0px;
      }
      
      .container {
        width: 100%;
        margin-right: -10px;
      }
      
      .row {
        box-sizing: border-box;
        padding-right: 10px;
        width: 25%;
        height: 100px;
        float: left;
      }
      .row:nth-of-type(odd){
          background-color: red;
      }
      .row:nth-of-type(even){
          background-color: blue;
      }
      .container::before {
        display: table;
        content: '';
      }

      .container::after {
        display: table;
        content: '';
        clear: both;
      }
      .container1{
        width: 100%;
        margin-right: -10px;
        font-size: 0;
      }
      .row1{
          display: inline-block;
          box-sizing: border-box;
          width: 25%;
          padding-right: 10px;
          height: 100px;
          font-size: 14px;
      }
      .row1:nth-of-type(odd){
          background-color: red;
      }
      .row1:nth-of-type(even){
          background-color: blue;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="row">第一列</div>
      <div class="row">第二列</div>
      <div class="row">第三列</div>
      <div class="row">第四列</div>
    </div>
    <div class="container1">
        <div class="row1">第一列</div>
        <div class="row1">第二列</div>
        <div class="row1">第三列</div>
        <div class="row1">第四列</div>
      </div>
  </body>
</html>
